package cn.jiadakeji.parent.controller;

import cn.jiadakeji.parent.common.core.controller.BaseController;
import cn.jiadakeji.parent.common.core.domain.AjaxResult;
import cn.jiadakeji.parent.common.page.TableDataInfo;
import cn.jiadakeji.parent.domain.TermTimeCourse;
import cn.jiadakeji.parent.dto.TermTimeCourseDTO;
import cn.jiadakeji.parent.service.TermTimeCourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author heyanfeng
 * @create 2022-03-11 15:45
 */
@Api(value = "课堂列表信息", tags = {"课堂列表信息接口"})
@RestController
@RequestMapping("/timeCourse")
public class TermTimeCourseController extends BaseController {

    @Autowired
    private TermTimeCourseService timeCourseService;

    @ApiOperation("获取课堂列表信息")
    @GetMapping("/timeCourseWithId/{termCourseId}")
    public TableDataInfo getTimeCourse(
            @ApiParam("班课ID")
            @PathVariable("termCourseId") String termCourseId
    ) {
        startPage();
        List<TermTimeCourseDTO> termTimeCourseDTOList =
                timeCourseService.getTimeCourse(termCourseId);
        return getDataTable(termTimeCourseDTOList);
    }

    @ApiOperation("获取课节信息")
    @GetMapping("/getTimeCourseById/{timeId}")
    public AjaxResult getTimeCourseById(
            @ApiParam("课节ID")
            @PathVariable("timeId") String timeId
    ) {
        TermTimeCourseDTO termTimeCourseDTO = timeCourseService.getTimeCourseById(timeId);
        return AjaxResult.success(termTimeCourseDTO);
    }
}
